Distribution and consumption of digitally encoded video has largely eclipsed that of analog video. However, digital video encoders can still sometimes struggle with encoding video that includes complex and finely detailed scenes. For example, encoders can be set to attempt to achieve a target bitrate in the output bitstreams they produce, but encoding scenes with a low bitrate can decrease picture quality and/or lower detail in the output video.
Many encoders especially struggle with video that suddenly increase their complexity, such as at an abrupt scene change from a simple scene without much detail to a much more complex scene with a lot of fine detail. Encoders can be caught off guard by a sudden complexity change, and often attempt to encode a suddenly more complex scene with a quality level more appropriate for the earlier simple scene. When high quality encoding was being performed for the simple scene, encoding a more complex scene with the same quality settings can lead to a large increase in the number of bits being produced as the encoder attempts to capture the fine details of the complex scene. This jump in bitrate can cause buffer overflow, as the output bitstream can suddenly become larger than the encoder's buffer can hold.
When this type of buffer overflow occurs, many encoders resort to a panic mode in which they begin skipping the encoding of one or more frames until enough memory is regained in the encoder's buffer. Skipping frames can result in choppy or jerky video, which can often be noticed by viewers.
As is common, most encoders frequently attempt to refer to frames they have already encoded when coding new frames. This can decrease the number of bits produced in the output bitstream. For example, the encoder can describe changes between a new frame and other already-encoded frames, rather than encoding the entirety of the new frame.
However, when an encoder enters panic mode and skips frames, when it resumes encoding frames there can be fewer already-encoded frames to refer to when encoding new frames. The encoder may need to start encoding the entirety of new frames, which produces more bits than referring to already-encoded frames. As such, resuming encoding can lead to a spike in the number of bits being produced, which runs the risk of again overflowing the encoder's buffer.
Overproducing bits in an output bitstream can also cause other problems down the line when the encoder is a part of a larger system, such as a statistical multiplexer. For example, the overproduced bits can exceed the bandwidth allocated by the multiplexer, leading to data dropping on the multiplexer or delayed arrival to decoding devices.